﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Vanfa.Entities.User;
using Vanfa.Biz.User;
using Vanfa.Common;
using Vanfa.Web.UI;

namespace Vanfa.Web
{
    public partial class profile : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtMobile1.Text = UserData.Mobile;
            }
        }

        protected void save_Click(object sender, EventArgs e)
        {
            UserProfileMag.Fill(SetUserPrivInfo());
            //To Next Step
            Response.Redirect("work.aspx");
            //Toolkit.MessageBox("补充信息填写成功！", "work.aspx", this);
        }

        private vUserPrivInfo SetUserPrivInfo()
        {
            var upi = new vUserPrivInfo
            {
                Birthday = Convert.ToDateTime(txtBDay.Text.Trim()),
                Email = txtEmail.Text.Trim(),
                FullName = txtFullName.Text.Trim(),
                Height = Convert.ToInt32(txtHgt.Text.Trim()),
                Icon = wIconUpload.IconPath,
                IDCard = txtIDCard.Text.Trim(),
                Location = ddlLocation.SelectedValue,
                Mobile1 = txtMobile1.Text.Trim(),
                Mobile2 = txtMobile2.Text.Trim(),
                NickName = txtNickName.Text.Trim(),
                P1 = Convert.ToInt32(txtP1.Text.Trim()),
                P2 = Convert.ToInt32(txtP2.Text.Trim()),
                P3 = Convert.ToInt32(txtP3.Text.Trim()),
                P4 = Convert.ToInt32(rdlP4.SelectedValue),
                P5 = Convert.ToInt32(rdlP5.SelectedValue),
                P6 = Convert.ToInt32(rblP6.SelectedValue),
                P7 = cblP7.SelectedValue,
                QQ = txtqq.Text.Trim(),
                UserID = UserData.UserID,
                WBo = txtWeibo.Text.Trim(),
                WChat = txtWebChat.Text.Trim(),
                Weight = Convert.ToInt32(txtWgt.Text.Trim())
            };
            return upi;
        }
    }
}